package com.tsinkai.ettp.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.GetMethod;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.tsinkai.ettp.common.ResultModel;


@Controller
@RequestMapping("/thymeleaf")
public class ThymeleafController {
	
	
	@RequestMapping("/hello")
	public String hello(HttpServletRequest req,HttpServletResponse resp){
		System.out.println("hello");
		return "hello";
		
	}
	
	@ResponseBody
	@RequestMapping("/test")
	public ResultModel test(HttpServletRequest req,HttpServletResponse resp){
		System.out.println("test");
		return ResultModel.ok("hello");
		
	}
	
//	@RequestMapping("/mav")
//	public ModelAndView testModelAndView() {
//		Map<String, Object> map = new HashMap<>();
//		map.put("name", "ki");
//		map.put("age", 12);
//		
//		
//		return new ModelAndView("hello",map);
//	}
//	
//	@RequestMapping("/session")
//	public String testSession(HttpServletRequest request) {
//		HttpSession session = request.getSession();
//		session.setAttribute("name", "session");
//		
//		return "hello";
//	}
	
}
